from os import environ
environ.setdefault('DJANGO_SETTINGS_MODULE', 'duetopia.register.settings')

from django.db.transaction import commit_on_success
from duetopia.register.models import *
urilist= (
	'http://atlas.gc.ca/cgi-bin/atlaswms_en',
	'http://wms1.agr.gc.ca/cgi-bin/mapquebec_en',
	'http://wms1.agr.gc.ca/cgi-bin/mapplant1967_f',
	'http://wms1.agr.gc.ca/cgi-bin/mapplant2000_f',
	'http://cgns.nrcan.gc.ca/wms/cubeserv.cgi',
	'http://excise.pyr.ec.gc.ca/cgi-bin/mapserv.exe?map=/LocalApps/Mapsurfer/PYRWQMP.map',
#	'http://gp2.chs-shc.dfo-mpo.gc.ca/wms/cascader', bad xml
#	'http://apps1.gdr.nrcan.gc.ca/cgi-bin/canmin_en-ca_ows',
	'http://gdr.ess.nrcan.gc.ca/wmsconnector/com.esri.wms.Esrimap/energy_e',
	'http://gdr.ess.nrcan.gc.ca/wmsconnector/com.esri.wms.Esrimap/GDR_E',
	'http://gdr.ess.nrcan.gc.ca/wmsconnector/com.esri.wms.Esrimap/geochron',
#	'http://webmap.em.gov.bc.ca/liteview6.5/servlet/MapGuideLiteView', weird error:
#	psycopg2.ProgrammingError: invalid input syntax for integer: "BC-ALBERS',


#	'http://www.geographynetwork.ca/wmsconnector/com.esri.wsit.WMSServlet/Geobase_NRN_NewfoundlandAndLabrador_I_Detail', 404
	'http://www2.dmsolutions.ca/cgi-bin/mswms_gmap',
#	'http://www.gworks.ca/site/lib/wms/simple_wms.php', 404

	'http://grid1.wdcb.ru/cgi-bin/mapserv?map=/var/www/html/mapFiles/maingis.map',
	'http://grid1.wdcb.ru/cgi-bin/mapserv?map=/var/www/html/mapFiles/mapFault.map',

	'http://wms.telascience.org/cgi-bin/ngBM_wms',
	'http://wms.telascience.org/cgi-bin/bm200401t_wms',
	'http://wms.telascience.org/cgi-bin/bm200401tb_wms',
	'http://wms.telascience.org/cgi-bin/katrina_ows',
	'http://wms.telascience.org/cgi-bin/hurricane_ows',

	'http://wms.jpl.nasa.gov/wms.cgi',
	'http://labs.metacarta.com/wms/vmap0',
	'http://datamil.delaware.gov/wmsconnector/com.esri.wms.Esrimap/DE_aerial02',
	'http://clearinghouse1.fgdc.gov/scripts/ogc/ms.pl',
#	'http://vesta.cast.uark.edu/wmscast/servlet/wmsesri', connection refused
	'http://wms.globexplorer.com/gexservlets/wms',
#	'http://maps1.intergraph.com/wms/ussample/request.asp', bad SRS
	'http://maps1.intergraph.com/wms/world/request.asp',
	'http://terraserver.microsoft.com/ogccapabilities.ashx',
	'http://deli.dnr.state.mn.us/cgi-bin/wms?map=DELI_WMS_MAPFILE',
#	'http://activefiremaps.fs.fed.us/wms/wms.asp', bad XML
#	'http://www.hazardmaps.gov/wmsRequest.php', no DNS
#	'http://aes.gsfc.nasa.gov/cgi-bin/wms', timeout
#	'http://nationalatlas.gov/natlas/capabilities.xml', no getMap operation?
	'http://mcmcwebmap.usgs.gov/OGCConnector/servlet/OGCConnector',
#	'http://web.apps.state.nd.us/wmsconnector/com.esri.wms.Esrimap', bad formats?
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Abilene-Taylor_County_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/AccuWeather_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Ada_County_ID_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Aiken_SC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alabama_DOT_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alabama_Geological_Survey.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alachua_County_FL_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alamance_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alaska_DFG_Commercial_Fisheries.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alaska_DFG_Sport_Fish_Division.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alaska_DFG_Wildlife_Conservation.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Albuquerque_NM_ArcIMS_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Albuquerque_NM_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alexander_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alexandria_VA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Allegany_County_MD_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Allegheny_County_PA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Allen_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alternative_Fuels_Data_Center.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Alvin_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Ameregis_Corp_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Amherst_NY_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Anchorage_AK_City_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Anchorage_AK_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Anderson_County_SC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Anson_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Apache_County_AZ_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Arapahoe_County_CO_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Ardmore_OK_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Arizona_DOT_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Arizona_SCO_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Arkansas_CAST_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Arkansas_CAST_Maps_2.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Arkansas_Educational_Facilities.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Arlington_Heights_IL_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/ARNG_Geographic_Data_Server.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Asheville_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Athens_County_OH_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Atlanta_GA_Regional_Commission.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Atlantic_County_NJ_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Augusta_County_VA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Augusta_GA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Austin_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Australia_Fire_Sentinel_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Azusa_CA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Bakersfield_CA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Baltimore_MD_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Baltimore_MD_Police_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Beaufort_County_SC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Bee_County_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Bergen_County_NJ_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Berkeley_County_SC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Bernalillo_County_NM_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Birmingham_AL_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Black_Hawk_County_IA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Boca_Raton_FL_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Boise_ID_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Boone_County_KY_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Boston_MA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Boulder_CO_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Bozeman_MT_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Brewster_County_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/British_Columbia_Canada_Disease_Control.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/British_Columbia_Canada_Fisheries.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/British_Geological_Survey_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Brookline_MA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Brooks_County_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Broome_County_NY_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Broomfield_CO_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Broward_County_FL_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Brunswick_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Bryan_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Buncombe_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Buncombe_County_NC_Sewerage_District.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Butler_County_OH_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/C_and_S_Engineers_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Cabarrus_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Cabell_County_WV_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Calaveras_County_CA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/California_DOT_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Cambridge_MA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Camden_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Cameron_County_TX_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Canada_Natural_Resources_Earth_Sciences.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Cape_May_County_NJ_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Carbon_County_UT_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Carrboro_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Carson_CA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Carson_CA_Maps_2.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Carter_County_OK_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Cascade_County_MT_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Catawba_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Central_Connecticut_State_University.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Charleston_County_SC_ArcIMS_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Charleston_County_SC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Charlotte_County_FL_GIS.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Chelsea_MA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Cherokee_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Chesapeake_Bay_Program.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Chicago_IL_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Chicago_IL_Public_Schools_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Chorley_Borough_UK_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Chula_Vista_CA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Chur_Switzerland_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Clallam_County_WA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Clark_County_NV_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Clark_County_WA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Clarksville_TN_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Clinton_County_MI_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Clovis_CA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Coconino_County_AZ_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Coeur_D%27Alene_Tribe_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Collier_County_FL_Appraiser_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Collier_County_FL_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Colorado_Dept_of_Education.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Colorado_Dept_of_Public_Health_and_Environment.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Colorado_NDIS_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Colorado_Springs_CO_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Columbus_County_NC_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Compass_Rose.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Concord_MA_Maps.wms',
	'http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/Condor_Earth_Tech_Maps.wms',
#	'http://hazards.fema.gov/wmsconnector/Servlet/flood', 404

#	'http://divenos.meraka.csir.co.za:8080/geoserver/wms', 404

#	'http://mds.glc.org/cgi-bin/carolwms', 404
#	'http://cgkn.net/cgi-bin/cgkn_wms', SRID Syntax
#	'http://geo.compusult.net/scripts/mapman.dll', Bad XML
	'http://maps.customweather.com/image',
#	'http://webapps.datafed.net/dvoy_services/ogc.wsfl', 500 error
	'http://131.220.126.148:8080/deegree/wms',

#	'http://gis.vibamt.dk/ArealInfo/AI_WMS.asp',
#	'http://www.wmap.cz/atlaszp/isapi.dll',
#	'http://www.metoc.gov.au:8080/wmsconnector/com.esri.wms.Esrimap', connection ref
	'http://audit.ea.gov.au/ogcwms/servlet/com.esri.ogc.wms.WMSServlet',
	'http://www.indexgeo.com.au/cgi-bin/wms-location',
#	'http://sidp.mapshed.com.au/wms/request', 404 

#	'http://mapserv2.esrin.esa.it/cubestor/cubeserv/cubeserv.cgi', invalid XML
#	'http://wms.gis.bv.tum.de/SICAD-IS60/isserver/ims/scripts/GetCapabilities.pl', 404
	'http://www.gis.nrw.de/wms/DGM50',
#	'http://195.27.54.43/wms/dlk/request.asp', unreachable
#	'http://www.gis2.nrw.de/wmsconnector/wms/stobo', Bad style, null name?
#	'http://iceds.ge.ucl.ac.uk/cgi-bin/icedswms', bat formats?
#	'http://iceds.ge.ucl.ac.uk/cgi-bin/wms?map=wms.map', ditto
#	'http://wms.geodan.nl/startdata/sclmapserver.exe', name or service not known
	'http://wms1.ccgis.de/cgi-bin/mapserv?map=/data/umn/germany/germany.map',
	'http://www.gis2.nrw.de/wmsconnector/wms/gewstat',
	'http://mapy.kr-vysocina.cz/cgi-bin/mapserv.exe?map=/gis/projekty/vysocina/vysocina_wms.map',
#	'http://www.landesvermessung.sachsen.de/ias/basiskarte/service/SRVDOPFREE/WMSFREE_TK/wmsservice', bad SRS
	'http://www.mapserver.niedersachsen.de/freezoneogc/mapserverogc',
#	'http://camber.mc.man.ac.uk/cgi-bin/mapserv.exe?map=c:%5CInetpub%5Cwwwroot%5CMIMAS%5Cwms_mimas_mosaic.map', bad XML

	'http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp',	
	'http://wms.larioja.org/request.asp',
	'http://camber.mc.man.ac.uk/ecwp/ecw_wms.dll',
	'http://katalog.lgrb.de/cgi-bin/mapserv',
	'http://www.gis2.nrw.de/wmsconnector/wms/linfos',
	
)

format = DataFormat.objects.get(mimetype = 'text/x-wms')
@commit_on_success
def mksource(uri):
	DataSource.objects.get_or_create(uri=uri, format=format)

for uri in urilist:
	try:
		mksource(uri)
		print 'GOOD', uri
	except:
		print 'ERROR', uri
